﻿using System;
using System.Configuration;

namespace Ue.Eagle.Runtime.Configuration
{
    public class PluginSection : System.Configuration.ConfigurationSection
    {
        /// <summary>
        /// 插件Id
        /// Ue.Core中的插件Id必须和目录命名空间一至
        /// </summary>
        [ConfigurationProperty(
            PluginConfigurationConstants.PluginIdAttributeName,
            IsKey = true,
            IsRequired = true)]
        public string Id
        {
            get { return base[PluginConfigurationConstants.PluginIdAttributeName] as string; }
        }

        /// <summary>
        /// 插件名称
        /// </summary>
        [ConfigurationProperty(
            PluginConfigurationConstants.PluginNameAttributeName,
            IsRequired = true)]
        public string Name
        {
            get { return base[PluginConfigurationConstants.PluginNameAttributeName] as string; }
        }

        /// <summary>
        /// 作者
        /// </summary>
        [ConfigurationProperty(
            PluginConfigurationConstants.PluginAuthorAttributeName,
            IsRequired = true)]
        public string Author
        {
            get { return base[PluginConfigurationConstants.PluginAuthorAttributeName] as string; }
        }

        /// <summary>
        /// 版本
        /// </summary>
        [ConfigurationProperty(
            PluginConfigurationConstants.PluginVersionAttributeName,
            DefaultValue = "1.0")]
        public string Version
        {
            get { return base[PluginConfigurationConstants.PluginVersionAttributeName] as string; }
        }

        /// <summary>
        /// 插件描述
        /// </summary>
        [ConfigurationProperty(
            PluginConfigurationConstants.PluginDescriptionAttributeName)]
        public string Description
        {
            get { return base[PluginConfigurationConstants.PluginDescriptionAttributeName] as string; }
        }

        /// <summary>
        /// 扩展点集合
        /// </summary>
        [ConfigurationProperty(
            PluginConfigurationConstants.PluginExtensionPointCollectionName)]
        public PluginExtensionPointCollection ExtensionPoints
        {
            get { return base[PluginConfigurationConstants.PluginExtensionPointCollectionName] as PluginExtensionPointCollection; }
        }

        /// <summary>
        /// 扩展集合
        /// </summary>
        [ConfigurationProperty(
            PluginConfigurationConstants.PluginExtensionCollectionName)]
        public PluginExtensionCollection Extensions
        {
            get { return base[PluginConfigurationConstants.PluginExtensionCollectionName] as PluginExtensionCollection; }
        }
    }
}
